package cn.com.cifi.mars.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;

import com.baomidou.dynamic.datasource.annotation.DS;

import cn.com.cifi.mars.bean.dto.MonthAvgSaleRateDeviationDto;
import cn.com.cifi.mars.bean.dto.MymContractDto;
import cn.com.cifi.mars.bean.dto.MymGetinDto;
import cn.com.cifi.mars.bean.dto.MymOrderDto;
import cn.com.cifi.mars.entity.MymContract;
import cn.com.cifi.mars.mapper.mars.MymMapper;
import cn.com.cifi.mars.service.MymService;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Service
@DS("mym")
public class MymServiceImpl implements MymService{

	@Autowired
	private MymMapper mymMapper;
	
	@DS("mym")
	@Override
	public int selectOrderCount() {
		return mymMapper.selectOrderCount();
	}
	
	@DS("mym")
	@Override
	public List<MymOrderDto> selectOrders() {
		return mymMapper.selectOrders();
	}
	
	@DS("mym")
	@Override
	public int selectContractCount() {
		return mymMapper.selectContractCount();
	}
	
	@DS("mym")
	@Override
	public List<MymContractDto> selectContracts() {
		return mymMapper.selectContracts();
	}
	
	@DS("mym")
	@Override
	public int selectGetinCount() {
		return mymMapper.selectGetinCount();
	}
	
	@DS("mym")
	@Override
	public List<MymGetinDto> selectGetins() {
		return mymMapper.selectGetins();
	}

	@DS("mym")
	@Override
	public List<MymContractDto> selectNewestContractsByProjectFid(String kingdeeProjectfId) {
		return mymMapper.selectNewestContractsByProjectFid(kingdeeProjectfId);
	}


	@DS("mym")
	public List<MymContractDto> selectMymContractList(List<String> bldPrdIDs) {
		List<MymContractDto>list=mymMapper.selectMymContractList(bldPrdIDs);
		return list;
	}
	
	@DS("mym")
	public String selectMymCjRmbTotal(List<String> bldPrdIDs,String beginTime,String endTime,String status) {
		String amount=mymMapper.selectMymCjRmbTotal(bldPrdIDs,beginTime,endTime,status);
		return amount;
	}
	
	@DS("mym")
	public String selectMymCommercialAmount(String productName, String beginTime, String endTime,
			String status) {
		String amount=mymMapper.selectMymCommercialAmount(productName, beginTime,endTime,status);
		return amount;
	}
	
	@DS("mym")
	public String selectMymLastYearCommercialAmount(String productName, String year, String status) {
		String amount=mymMapper.selectMymLastYearCommercialAmount(productName, year,status);
		return amount;
	}

	@DS("mym")
	public List<MonthAvgSaleRateDeviationDto> selectMymCommercialTimeNum(String productName, String beginTime,
			String endTime, String status) {
		return mymMapper.selectMymCommercialTimeNum(productName, beginTime, endTime, status);
	}

	@DS("mym")
	public List<MonthAvgSaleRateDeviationDto> selectMymLastYearCommercialTimeNum(String productName, String year,
			String status) {
		return mymMapper.selectMymLastYearCommercialTimeNum(productName, year, status);
	}
	
	/**
	 * 查询项目编码
	 */
	@DS("mym")
	public List<String> selectMyCodeList(String isDel) {
		return mymMapper.selectMyCodeList(isDel);
	}
	
	/**
	 * 查询明源签约视图
	 * @param month
	 * @return
	 */
	@DS("mym")
	@Override
	public List<MymContract> selectAllContract(int month) {
		log.info(month+":月份");
		return mymMapper.selectAllContract(month);
	}
	
	/**
	 * 增加明源签约视图
	 */
	@Override
	public void insertContractList(List<MymContract> list) {
		mymMapper.insertContractList(list);
	}
	
	
}
